// 自定义hook
import { onMounted, onUnmounted, reactive } from 'vue'
export default function () {
  const point = reactive({
    x: 0,
    y: 0
  })
  const savePonit = (event: MouseEvent) => {
    point.x = event.pageX
    point.y = event.pageY
  }
  onMounted(() => {
    window.addEventListener('click', savePonit)
  })
  onUnmounted(() => {
    window.removeEventListener('click', savePonit)
  })
  return point
}
